package com.eian.boot.module.system.log.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统登录日志表 实体类
 *
 * @author alex.meng
 * @since 1.0.0
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "t_sys_login_log")
public class SysLoginLogEntity implements Serializable {

    /**
     * 主键ID
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 创建时间
     */
    @Column(value = "created_at", onInsertValue = "now()")
    private LocalDateTime createdAt;

    /**
     * 链路追踪ID
     */
    @Column(value = "trace_id")
    private String traceId;

    /**
     * 用户ID（登录成功后记录）
     */
    @Column(value = "user_id")
    private Long userId;

    /**
     * 登录账号
     */
    @Column(value = "username")
    private String username;

    /**
     * 登录类型：1-账号密码，2-手机验证码，3-邮箱验证码，4-第三方登录，5-扫码登录
     */
    @Column(value = "login_type")
    private Integer loginType;

    /**
     * 登录状态：1-成功，0-失败
     */
    @Column(value = "login_status")
    private Integer loginStatus;

    /**
     * 登录IP地址
     */
    @Column(value = "login_ip")
    private String loginIp;

    /**
     * IP归属地
     */
    @Column(value = "login_location")
    private String loginLocation;

    /**
     * 浏览器类型
     */
    @Column(value = "browser")
    private String browser;

    /**
     * 操作系统
     */
    @Column(value = "os")
    private String os;

    /**
     * 用户代理
     */
    @Column(value = "user_agent")
    private String userAgent;

    /**
     * 提示消息
     */
    @Column(value = "msg")
    private String msg;

    /**
     * 登录令牌（登录成功后记录）
     */
    @Column(value = "token")
    private String token;

    /**
     * 会话ID
     */
    @Column(value = "session_id")
    private String sessionId;
}


